<?php
	session_start();
	require 'include/configDB.php';
	$id_pengguna = $_SESSION['id_pengguna'];
	//echo "$id_pengguna";
	$query_wali = mysql_query("SELECT * FROM penugasan_wali WHERE NIK='$id_pengguna'");
	$wali_data = mysql_fetch_assoc($query_wali);
	$id_kelas = $wali_data['id_kelas'];
	$query_kelas = mysql_query("SELECT * FROM kelas WHERE id='$id_kelas'");
	$kelas_data = mysql_fetch_assoc($query_kelas);
	$id_jurusan = $kelas_data['id_jurusan'];
	$jurusan_query = mysql_query("SELECT * FROM jurusan WHERE id='$id_jurusan'");
	$jurusan_data = mysql_fetch_assoc($jurusan_query);
	// echo "$id_kelas";
	// exit;
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Laporan Nilai Wali Kelas</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="clockp.js"></script>
<script type="text/javascript" src="clockh.js"></script> 
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="ddaccordion.js"></script>
<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})
</script>

<script type="text/javascript" src="jconfirmaction.jquery.js"></script>
<script type="text/javascript">
	
	$(document).ready(function() {
		$('.ask').jConfirmAction();
	});
	
</script>

<script language="javascript" type="text/javascript" src="niceforms.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="niceforms-default.css" />
<style>
	<?php include 'include_style.php'; ?>
</style>
</head>
<body>
<div id="main_container">

	<?php include 'header.php'; ?>
    
    <div class="main_content">
                
                    
    <div class="center_content">  
		
    
	
    <div class="left_content">
    
    		<?php include 'left_content.php'; ?>
    		<?php include 'calendar.php' ; ?>

    </div>  
    
    <div class="right_content">
	<h2>Data Nilai Akademik</h2>
	<h4>Laporan nilai berdasarkan Mata Pelajaran</h4>
	<form name="wali_kelas_form" id="wali_kelas_form" method="post" action="laporan_data_nilaiWakesMatpel.php">
		<table>
			<tr>
				<td>
					Kelas 
				</td>
				<td>
					:
				</td>
				<td>
					<?=$kelas_data['tingkat']?>
				</td>
				<td>
					Jurusan
				</td>
				<td>
					:
				</td>
				<td>
					<?=$jurusan_data['nama']?>
				</td>
				<td></td>
				<td>
					<?=$kelas_data['nomor']?>
				</td>
			</tr>
			<tr>
				<td>
					Mata Pelajaran
				</td>
				<td>:</td>
				<?php
					$query_max = mysql_query("SELECT MAX(id) AS max_id FROM tahun_ajaran");
					$max_data = mysql_fetch_assoc($query_max);
					$id_tahun_ajaran = $max_data['max_id'];
					$query_jadpel = mysql_query("SELECT DISTINCT id_penugasan FROM jadwal_pelajaran WHERE id_kelas='$id_kelas' AND id_tahun_ajaran='$id_tahun_ajaran'");

				?>
				<td>
					<select name= "matpel">
						<option value="NULL">---------Pilih----------</option>
						<?php
							while ($jadpel_data = mysql_fetch_assoc($query_jadpel)) 
							{
								$id_penugasan=$jadpel_data['id_penugasan'];
								$penugasan_query = mysql_query("SELECT * FROM penugasan_guru WHERE id='$id_penugasan' ");
								$penugasan_data = mysql_fetch_assoc($penugasan_query);
								$id_matpel = $penugasan_data['id_matpel'];
								$matpel_data = mysql_fetch_assoc(mysql_query("SELECT * FROM mata_pelajaran WHERE id='$id_matpel'"));
						?>
							<option value="<?php echo $matpel_data['id']?>" <?php if (isset($_POST['matpel']) && ($_POST['matpel'] == $matpel_data['id'])) echo "selected";?>><?php echo $matpel_data['nama']?></option>
						<?php 
							}
						?>
					</select>
				</td>
			</tr>
			<tr>	
				<td>
					Semester
				</td>
				<td>:</td>
				<td>
					<select name="semester">
						<option value="">---------Pilih----------</option>
						<option value="Genap" <?php if (isset($_POST['semester']) && ($_POST['semester'] == "Genap")) echo "selected";?>>Genap</option>
						<option value="Ganjil" <?php if (isset($_POST['semester']) && ($_POST['semester'] == "Ganjil")) echo "selected";?>>Ganjil</option>
					</select>
				</td>
			</tr> 
			<tr>
				<td>
					<input type="submit" name="submit" class="menuitem_red" value="Lihat"/>
				</td>	
			</tr>
		</table>
		</form>
	<br>
	<br>
	<h4>Laporan nilai berdasarkan Nama Siswa</h4>
	<form name="wali_kelas_form" id="wali_kelas_form" method="post" action="laporan_data_nilaiWakesSiswa.php">
		<table>
			<tr>
				<td>
					Kelas 
				</td>
				<td>
					:
				</td>
				<td>
					<?=$kelas_data['tingkat']?>
				</td>
				<td>
					Jurusan
				</td>
				<td>
					:
				</td>
				<td>
					<?=$jurusan_data['nama']?>
				</td>
				<td></td>
				<td>
					<?=$kelas_data['nomor']?>
				</td>
			</tr>
			<tr>	
				<td>
					Semester
				</td>
				<td>:</td>
				<td>
					<select name="semester">
						<option value="">---------Pilih----------</option>
						<option value="Genap" <?php if (isset($_POST['semester']) && ($_POST['semester'] == "Genap")) echo "selected";?>>Genap</option>
						<option value="Ganjil" <?php if (isset($_POST['semester']) && ($_POST['semester'] == "Ganjil")) echo "selected";?>>Ganjil</option>
					</select>
				</td>
			</tr> 
			<tr>
				<td>
					<input type="submit" name="submit" class="menuitem_red" value="Lihat"/>
				</td>	
			</tr>
		</table>
		</form>
    </div><!-- end of right content-->
            
                    
  </div>   <!--end of center content -->               
                    
                    
    
    
    <div class="clear"></div>
    </div> <!--end of main content-->
	
    
    <div class="footer">
        	<?php include 'footer.php'; ?>

    	
    </div>

</div>	
</form>	
</body>
</html>